<template>
  <!-- 边民互市页面 -->
  <div class="container">
    <div class="section top-section">
      <border-wrap>
        <div class="title"><h2>上月数据</h2></div>
        <div class="content">
          <div class="section01">
            <div class="neu-table-data-card target-item" v-for="item,index in targetList" :key="item.name">
              <div class="card-icon card-ceil"><img :src="require(`../../assets/images/icon-target0${index+1}.png`)" alt=""></div>
              <div class="card-total card-ceil">
                <h2>{{item.value}}</h2>
                <small>{{item.name}}</small>
              </div>
              <div class="card-percent card-ceil">
                <h2>
                  <i :class="['iconfont', {'icon-arrow':item.status,'icon-arrow-down':!item.status}]"></i>
                  <span>{{item.percent}}%</span>
                </h2>
                <small>同比</small>
              </div>
            </div>
        </div>
        </div>
      </border-wrap>
    </div>
    <div class="section middle-section">
      <div class="left-content">
        <border-wrap>
          <div class="title"><h2>申报商品类型top5</h2></div>
          <div class="content">
            <div class="section02">
              <div class="rank-chart-section">
                <div class="tab-list">
                  <div class="neu-tab-list item-start">
                    <div class="tab-item active"><span>上月</span></div>
                    <div class="tab-item"><span>本年</span></div>
                  </div>
                </div>
                <div class="rank-chart-content">
                  <div class="rank-content">
                    <rank-list
                      :dataList="rankData01"
                      size="small"
                    ></rank-list>
                  </div>
                  <div class="chart-content">
                    <div class="neu-pie-chart">
                      <div class="chart-detail">
                        <span>南宁进口总量</span>
                        <b>148,6586</b>
                      </div>
                      <div class="chart-content">
                        <div class="chart-content-main" id="s2PieChart"></div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </border-wrap>
      </div>
      <div class="right-content">
        <border-wrap>
          <div class="title"><h2>边民互市交易人次趋势</h2></div>
          <div class="content">
            <div class="section03" id="s3MainChart">
              
            </div>
          </div>
        </border-wrap>
      </div>
    </div>
    <div class="section bottom-section">
      <div class="left-content">
        <border-wrap>
          <div class="title"><h2>交易商品类型top5</h2></div>
          <div class="content">
            <div class="section04">
              <div class="rank-chart-section">
                <div class="tab-list">
                  <div class="neu-tab-list item-start">
                    <div class="tab-item active"><span>上月</span></div>
                    <div class="tab-item"><span>本年</span></div>
                  </div>
                </div>
                <div class="rank-chart-content">
                  <div class="rank-content">
                    <rank-list
                      :dataList="rankData02"
                      size="small"
                    ></rank-list>
                  </div>
                  <div class="chart-content">
                    <div class="neu-pie-chart">
                      <div class="chart-detail">
                        <span>南宁进口总量</span>
                        <b>148,6586</b>
                      </div>
                      <div class="chart-content">
                        <div class="chart-content-main" id="s4PieChart"></div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>    
          </div>
        </border-wrap>
      </div>
      <div class="right-content">
        <border-wrap>
          <div class="title"><h2>边民互市货物交易量趋势</h2></div>
          <div class="content">
            <div class="section05" id="s5MainChart">

            </div>
          </div>
        </border-wrap>
      </div>
    </div>
  </div>
</template>

<script>
import borderWrap from '../../components/commons/borderWrap.vue';
import rankList from '../../components/commons/rankList.vue';
import {
  createLineBarChart,
  createPieChart,
  createGradientColor
} from '../../utils/plugins/common'
export default {
  name: "bianminHushi",
  components:{
    borderWrap,
    rankList
  },
  data(){
    return {
      targetList:[{
        name:"边民互市货物量",
        value:21666,
        percent:34,
        status:0
      },{
        name:"交易人次",
        value:21666,
        percent:34,
        status:0
      },{
        name:"边民交易金额",
        value:21666,
        percent:34,
        status:1
      },{
        name:"商品申报数",
        value:21666,
        percent:34,
        status:1
      }],
      rankData01:[{
        name:"矿石",
        percent:{
          value:23,
          status:1
        },
        value:1000
      },{
        name:"矿石",
        percent:{
          value:23,
          status:1
        },
        value:1000
      },{
        name:"矿石",
        percent:{
          value:23,
          status:0
        },
        value:1000
      },{
        name:"矿石",
        percent:{
          value:23,
          status:0
        },
        value:1000
      },{
        name:"矿石",
        percent:{
          value:23,
          status:0
        },
        value:1000
      }],
      rankData02:[{
        name:"矿石",
        percent:{
          value:23,
          status:1
        },
        value:1000
      },{
        name:"矿石",
        percent:{
          value:23,
          status:1
        },
        value:1000
      },{
        name:"矿石",
        percent:{
          value:23,
          status:0
        },
        value:1000
      },{
        name:"矿石",
        percent:{
          value:23,
          status:0
        },
        value:1000
      },{
        name:"矿石",
        percent:{
          value:23,
          status:0
        },
        value:1000
      }],
    }
  },
  mounted(){
    createPieChart({
      id:"s2PieChart",
      config:{
        data:[{
          name:"aaa",
          value:10
        },{
          name:"bbb",
          value:10
        },{
          name:"ccc",
          value:10
        },{
          name:"ddd",
          value:10
        },{
          name:"eee",
          value:10
        },{
          name:"fff",
          value:10
        }]
      },
      option:{
        color:["#C4292D","#D87D30","#DFAA04","#5287D0","#55ABB7","#49759B"],
        series: {
          radius: ['170%', '200%']
        }
      }
    })
    createPieChart({
      id:"s4PieChart",
      config:{
        data:[{
          name:"aaa",
          value:10
        },{
          name:"bbb",
          value:10
        },{
          name:"ccc",
          value:10
        },{
          name:"ddd",
          value:10
        },{
          name:"eee",
          value:10
        },{
          name:"fff",
          value:10
        }]
      },
      option:{
        color:["#C4292D","#D87D30","#DFAA04","#5287D0","#55ABB7","#49759B"],
        series: {
          radius: ['170%', '200%']
        }
      }
    })
    createLineBarChart({
      id:"s3MainChart",
      config:{
        xAxisData:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],
        data:[{
          type:"line",
          area:true,
          areaColor:createGradientColor("toBottom",["rgba(3, 112, 255, 0.5)","rgba(3, 112, 255, 0)"]),
          name:"进口",
          data:[200,210,178,197,398,456,221,150,199,299,456,221]
        }]
      },
      option:{
        color:["rgba(0, 187, 255, .8)"],
        legend:{
          show: false
        },
        grid:{
          top: "10%"
        }
      }
    })
    createLineBarChart({
      id:"s5MainChart",
      config:{
        xAxisData:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],
        data:[{
          type:"line",
          area:true,
          areaColor:createGradientColor("toBottom",["rgba(0, 211, 114, 0.5)","rgba(0, 211, 114, 0)"]),
          name:"进口",
          data:[200,210,178,197,398,456,221,150,199,299,456,221]
        }]
      },
      option:{
        color:["rgba(0, 211, 114, .8)"],
        legend:{
          show: false
        },
        grid:{
          top: "10%"
        }
      }
    })
  }
}
</script>

<style lang="scss" scoped>
.container{
  height: 100%;
  .section{
    width: 100%;
    height: calc((100% - 240px)/2);
    div.title{
      h2{
        height: 30px;
        padding-left: 20px;
        line-height: 30px;
        font-size: 16px;
      }
    }
    div.content{
      box-sizing: border-box;
      width: 100%;
      height: calc(100% - 30px);
      box-sizing: border-box;
      padding: 20px;
      .rank-chart-section{
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        .tab-list{
          width: 100%;
          height: 30px;
          margin-bottom: 20px;
          .tab-item{
            padding: 0 50px;
          }
        }
        .rank-chart-content{
          width: 100%;
          height: 180px;
          display: flex;
          justify-content: space-between;
          align-items: center;
          .rank-content{
            width: 60%;
            height: 100%;
          }
          .chart-content{
            display: flex;
            justify-content: center;
            align-items: center;
            width: 180px;
            height: 180px;
            .chart-content-main{
              width: 160px;
              height: 160px;
            }
          }
        }
      }
    }
    .left-content{
      height: 100%;
      width: 30%;
    }
    .right-content{
      height: 100%;
      width: 70%;
      margin-left: 30px;
    }
    &.top-section{
      height: 200px;
      .content{
        display: flex;
        justify-content: center;
        align-items: center;

      }
    }
    &.middle-section{
      display: flex;
      justify-content: space-around;
      align-items: center;
      margin: 20px 0;
    }
    &.bottom-section{
      display: flex;
      justify-content: space-around;
      align-items: center;
    }
    .section01{
      width: 100%;
      height: 120px;
      display: flex;
      justify-content: space-around;
      align-items: center;
      .target-item{
        margin: 0 30px;
        .card-icon{
          img{
            width: auto;
            height: 40px;
          }
        }
        .card-ceil{
          width: 33%;
        }
      }
    }
    .section02{
      height: 100%;
    }
    .section03{
      height: 100%;
    }
    .section04{
      height: 100%;
    }
    .section05{
      height: 100%;
    }
  }
}
</style>